1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.Application; 26 27 private import adw.StyleManager; 28 private import adw.c.functions; 29 public import adw.c.types; 30 private import glib.ConstructionException; 31 private import glib.Str; 32 private import gobject.ObjectG; 33 private import gtk.Application : DGtkApplication = Application; 34 35 36 /** 37 * A base class for Adwaita applications. 38 * 39 * `AdwApplication` handles library initialization by calling [func@init] in the 40 * default [signal@Gio.Application::startup] signal handler, in turn chaining up 41 * as required by [class@Gtk.Application]. Therefore, any subclass of 42 * `AdwApplication` should always chain up its `startup` handler before using 43 * any Adwaita or GTK API. 44 * 45 * ## Automatic Resources 46 * 47 * `AdwApplication` will automatically load stylesheets located in the 48 * application's resource base path (see 49 * [method@Gio.Application.set_resource_base_path], if they're present. 50 * 51 * They can be used to add custom styles to the application, as follows: 52 * 53 * - `style.css` contains styles that are always present. 54 * 55 * - `style-dark.css` contains styles only used when 56 * [property@StyleManager:dark] is `TRUE`. 57 * 58 * - `style-hc.css` contains styles used when the system high contrast 59 * preference is enabled. 60 * 61 * - `style-hc-dark.css` contains styles used when the system high contrast 62 * preference is enabled and [property@StyleManager:dark] is `TRUE`. 63 * 64 * Since: 1.0 65 */ 66 public class Application : DGtkApplication 67 { 68 /** the main Gtk struct */ 69 protected AdwApplication* adwApplication; 70 71 /** Get the main Gtk struct */ 72 public AdwApplication* getAdwApplicationStruct(bool transferOwnership = false) 73 { 74 if (transferOwnership) 75 ownedRef = false; 76 return adwApplication; 77 } 78 79 /** the main Gtk struct as a void* */ 80 protected override void* getStruct() 81 { 82 return cast(void*)adwApplication; 83 } 84 85 /** 86 * Sets our main struct and passes it to the parent class. 87 */ 88 public this (AdwApplication* adwApplication, bool ownedRef = false) 89 { 90 this.adwApplication = adwApplication; 91 super(cast(GtkApplication*)adwApplication, ownedRef); 92 } 93 94 95 /** */ 96 public static GType getType() 97 { 98 return adw_application_get_type(); 99 } 100 101 /** 102 * Creates a new `AdwApplication`. 103 * 104 * If `application_id` is not `NULL`, then it must be valid. See 105 * [func@Gio.Application.id_is_valid]. 106 * 107 * If no application ID is given then some features (most notably application 108 * uniqueness) will be disabled. 109 * 110 * Params: 111 * applicationId = The application ID 112 * flags = The application flags 113 * 114 * Returns: the newly created `AdwApplication` 115 * 116 * Since: 1.0 117 * 118 * Throws: ConstructionException GTK+ fails to create the object. 119 */ 120 public this(string applicationId, GApplicationFlags flags) 121 { 122 auto __p = adw_application_new(Str.toStringz(applicationId), flags); 123 124 if(__p is null) 125 { 126 throw new ConstructionException("null returned by new"); 127 } 128 129 this(cast(AdwApplication*) __p, true); 130 } 131 132 /** 133 * Gets the style manager for @self. 134 * 135 * Returns: the style manager 136 * 137 * Since: 1.0 138 */ 139 public StyleManager getStyleManager() 140 { 141 auto __p = adw_application_get_style_manager(adwApplication); 142 143 if(__p is null) 144 { 145 return null; 146 } 147 148 return ObjectG.getDObject!(StyleManager)(cast(AdwStyleManager*) __p); 149 } 150 }